﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DataAccess_Layer
{
    public class UserInRoleDAC
    {
        public static string timRoleCuaUser(string userName)
        {
            aspnet_User us = DataAccessHelper.DB.aspnet_Users.Where(u => u.UserName == userName).Select(u => u).First();
            return DataAccessHelper.DB.aspnet_UsersInRoles.Where(uir => uir.UserId == us.UserId).Select(uir => uir.RoleId).First().ToString();
        }

        public static string timRoleNameCuaUser(string userName)
        {
            aspnet_User us = DataAccessHelper.DB.aspnet_Users.Where(u => u.UserName == userName).Select(u => u).First();
            return DataAccessHelper.DB.aspnet_UsersInRoles.Where(uir => uir.UserId == us.UserId).Select(uir => uir.aspnet_Role.RoleName).First();
        }
    }
}
